<?php
session_start();
include("connect.php");  //引用数据库链接文件
header('content-type:text/html;charset=utf-8');  
if($_SESSION['username']=="")
{
	echo "<script>alert('登录后操作');window.history.back();</script>";
}
else
	{
$tn=$_GET['action'];
 //获取页面传递的参数
$id=$_GET['id'];
  $username=$_SESSION['username'];
  $need=$_POST['need'];
  $title=$_POST['title'];
  $time=date("Y-m-d h:i");
 $sql="";
 
  if($tn=="assist")
 { //定义SQL语句
 $content=$_POST['content'];
$SQL= "insert into demand(id,username,content,time,need,title)values(null,'".$username."','".$content."','".$time."','".$need."','". $title."')";
  }
 if(mysqli_query($conn,$SQL)){
  echo "<script>alert('操作成功');window.history.back();</script>";
 }else{
   echo "<script>alert('操作失败');window.history.back();</script>";
 }

	}
?>